<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        .inputBox{position: relative;}
        .inputBox input{position: absolute;background:transparent;}
        .inputBox span{position: absolute;left:0;z-index: -1;color: #aaa;font-size:14px;}
    </style>
</head>
<body>
    <input type="text" placeholder="这是默认提示">

    <div class="inputBox">
        <input type="text">
        <span>这是默认提示</span>
    </div>
</body>
<script>

    var oIpt = document.querySelector(".inputBox input")
    var oSpan = document.querySelector(".inputBox span")

    oIpt.oninput = function(){
        if(oIpt.value === ""){
            oSpan.style.display = "block"
        }else{
            oSpan.style.display = "none"
        }
    }
    
</script>
</html>